package com.logicalthinking.socialmall.common.vo.responseVo.role;

import com.logicalthinking.socialmall.common.enums.AuthEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * 角色权限信息
 * @author Chen LiJia
 * @since 2020/2/17
 */
@Setter
@Getter
@ApiModel
public class AuthEnumVo {

    /**
     * 权限类别
     */
    @ApiModelProperty(value = "权限类别")
    private Integer authType;

    /**
     * 权限名称
     */
    @ApiModelProperty(value = "权限名称")
    private String authName;

    /**
     * 角色权限枚举类转化为角色权限信息
     * @param authEnum
     * @return
     */
    public static AuthEnumVo AuthEnumToAuthEnumVo(AuthEnum authEnum){
        if(Objects.nonNull(authEnum)){
            AuthEnumVo authEnumVo = new AuthEnumVo();
            authEnumVo.setAuthName(authEnum.getAuthName());
            authEnumVo.setAuthType(authEnum.getAuthType());
            return authEnumVo;
        }
        return null;
    }

}
